home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2003 March / DPPCPRO0303.ISO / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / WizardViewSubDbQuerySelect.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  4.9 KB  |  122 lines

  1. package asp.wizard;
  2.  
  3. import asp.netobjects.nfx.ui.OrderedListModel;
  4. import asp.netobjects.nfx.wizard.WizardPageView;
  5. import asp.wizard.util.UiUtil;
  6. import com.sun.java.swing.DefaultListModel;
  7. import com.sun.java.swing.JComboBox;
  8. import com.sun.java.swing.JComponent;
  9. import com.sun.java.swing.JTextArea;
  10. import com.sun.java.swing.ListModel;
  11. import java.awt.Component;
  12. import java.util.TooManyListenersException;
  13.  
  14. public class WizardViewSubDbQuerySelect extends WizardViewAbstract {
  15.    private static WizardViewAbstract _instance = null;
  16.    private WVPanelDbQuerySelect _mainPanel;
  17.    private SubDBQueryData _Data;
  18.    private boolean _updatingTableComboBox = false;
  19.  
  20.    public static WizardViewAbstract getInstance() {
  21.       if (_instance == null) {
  22.          _instance = new WizardViewSubDbQuerySelect();
  23.       }
  24.  
  25.       return _instance;
  26.    }
  27.  
  28.    public WizardViewSubDbQuerySelect() {
  29.       this.initListeners();
  30.    }
  31.  
  32.    private void initListeners() {
  33.       this._mainPanel._cboTables.addItemListener(new 1(this));
  34.  
  35.       try {
  36.          this._mainPanel._l2lProjections.addListToListXferItemListener(new 2(this));
  37.       } catch (TooManyListenersException e) {
  38.          System.err.println(((Throwable)e).getMessage());
  39.       }
  40.  
  41.    }
  42.  
  43.    private Object handleGetItemToXfer(Object sourceItem) {
  44.       Object result = null;
  45.       WizardModelSubDbQuerySelect model = (WizardModelSubDbQuerySelect)((WizardPageView)this).getModel();
  46.       if (model != null) {
  47.          String value = model.handleGetItemToXfer(sourceItem).toString();
  48.          if (!UiUtil.valueExistsInListModel((DefaultListModel)this._mainPanel._l2lProjections.getRightList().getModel(), value)) {
  49.             result = value;
  50.          }
  51.       }
  52.  
  53.       return result;
  54.    }
  55.  
  56.    protected void createMainPanel() {
  57.       this._mainPanel = new WVPanelDbQuerySelect();
  58.    }
  59.  
  60.    public WVPanelBase getMainPanel() {
  61.       return this._mainPanel;
  62.    }
  63.  
  64.    public JComboBox getTableCombo() {
  65.       return this._mainPanel._cboTables;
  66.    }
  67.  
  68.    public String getSelectedTable() {
  69.       return (String)this._mainPanel._cboTables.getSelectedItem();
  70.    }
  71.  
  72.    public void setAvailableFieldModel(ListModel lm) {
  73.       this._mainPanel._l2lProjections.setLeftListModel(lm);
  74.    }
  75.  
  76.    public void selectField(int i) {
  77.       this._mainPanel._l2lProjections.getLeftList().setSelectedIndex(0);
  78.    }
  79.  
  80.    public OrderedListModel getFields() {
  81.       return (OrderedListModel)this._mainPanel._l2lProjections.getRightList().getModel();
  82.    }
  83.  
  84.    public void setSelectedFields(ListModel olm) {
  85.       this._mainPanel._l2lProjections.getRightList().setModel(olm);
  86.    }
  87.  
  88.    public void setTableComboBoxModel(OrderedListModel comboModel) {
  89.       this._updatingTableComboBox = true;
  90.  
  91.       try {
  92.          UiUtil.populateCombo(this.getTableCombo(), comboModel);
  93.          if (((DefaultListModel)comboModel).getSize() > 0) {
  94.             this.getTableCombo().setSelectedIndex(0);
  95.          }
  96.       } finally {
  97.          this._updatingTableComboBox = false;
  98.       }
  99.  
  100.    }
  101.  
  102.    public void setContainingSpaceWarningVisible(boolean visible) {
  103.       JTextArea txa = this._mainPanel._txaContainingSpaceWarning;
  104.       if (visible && !((Component)txa).isVisible()) {
  105.          ((JComponent)txa).setVisible(true);
  106.       } else if (!visible && ((Component)txa).isVisible()) {
  107.          ((JComponent)txa).setVisible(false);
  108.       }
  109.  
  110.    }
  111.  
  112.    // $FF: synthetic method
  113.    static boolean access$0(WizardViewSubDbQuerySelect $0) {
  114.       return $0._updatingTableComboBox;
  115.    }
  116.  
  117.    // $FF: synthetic method
  118.    static Object access$1(WizardViewSubDbQuerySelect $0, Object $1) {
  119.       return $0.handleGetItemToXfer($1);
  120.    }
  121. }
  122.